/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			main_tests.cc
  \date			Jul 2011
  \author		TNick

  \brief		Contains application's entry point


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<QApplication>
#include	<QDebug>

#include	<pgscript.h>
#include	<pgscript_internal.h>


#include	<session.h>
#include	<module.h>
#include	<uservar.h>
#include	<userfunc.h>

#include	<pgsave/ipgsave.h>
#include	<pgsave/pgsqs.h>
#include	<pgsave/pgsxml.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DATA    ---------------------------------------------------------------- */





/*  DATA    ================================================================ */
//
//
//
//
/*  FUNCTIONS    ----------------------------------------------------------- */

/* ------------------------------------------------------------------------- */
int			main				( int argc, char *argv[] )
{
#ifndef	PGSCRIPT_TESTS
	qDebug() << "Build error. Test must have PGSCRIPT_TESTS defined.";
	return -1;
#endif

	qDebug() << "";
	qDebug() << "-----------------------------------------------------------";
	qDebug() << "----             PgScript tests started                ----";
	qDebug() << "-----------------------------------------------------------";
	qDebug() << "";

	/* prepare to start */
	QApplication apl(argc, argv);
	Q_UNUSED( apl );

	/* prepare the ground for easy access to settings */
	QCoreApplication::setOrganizationName( "TNick" );
	QCoreApplication::setOrganizationDomain( "sites.google.com/site/tnickweb/" );
	QCoreApplication::setApplicationName( "PgScript_tests" );

	/* start the library */
	PgScr::initialise();


	int performed = 0;
	int succeded = 0;
	int crt_performed = 0;
	int crt_succeded = 0;
	QString	Outcm;


	if ( PgScr::Session::def_ss != NULL )	TEST_OK
	else	TEST_FAIL
	qDebug() << "Test default session..." << Outcm;
	performed++;

	PgScr::Session_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;

	PgScr::Module_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;

	PgScr::Variable_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;

	PgScr::Func_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;


	/* PgSave tests */

	PgSave::IPgSave_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;

	PgSave::PgsQs_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;

	PgSave::PgsXml_Tests( crt_performed, crt_succeded );
	Q_ASSERT( crt_succeded <= crt_performed );
	performed += crt_performed;
	succeded += crt_succeded;







	/* stop the library */
	PgScr::terminate();


	qDebug() << "";
	qDebug() << "-----------------------------------------------------------";
	qDebug() << "----             PgScript tests completed              ----";
	qDebug() << "-----------------------------------------------------------";
	qDebug() << "Succesfull tests: " << succeded;
	qDebug() << "Failed tests:     " << ( performed - succeded );
	qDebug() << "Total number of tests performed: " << performed;
	qDebug() << "-----------------------------------------------------------";
	qDebug() << "";
	return ( performed == succeded ? 0 : -1 );
}
/* ========================================================================= */

/*  FUNCTIONS    =========================================================== */
//
//
//
//
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
